import { request } from "@/utils/request"
const prefix = '/user'

interface addUserParams {
	username: string,
	password: string,
	avater: string,
	phone: string,
	name: string,
	sex: number,
	aid: number
}
/**
 * 添加用户
 * @param params 
 * @returns 
 */
export const addUserRequest = (params: addUserParams) => {
	return request.post(`${prefix}/addUser`, params)
}

/**
 * 获取当前管理员的管理的用户
 * @returns 
 */
export const getUserRequest = () => {
	return request.get(`${prefix}/getUser`)
}

interface reviserUserParams {
	username: string,
	password: string,
	avater: string,
	phone: string,
	name: string,
	sex: number,
	aid: number
}
/**
 * 修改用户
 * @param params 
 * @returns 
 */
export const reviseUserRequest = (params: reviserUserParams) => {
	return request.put(`${prefix}/reviseUser`, params)
}

/**
 * 删除用户
 * @param param 用户id
 * @returns
 */
export const deleteUserRequest = (param: number) => {
	return request.delete(`${prefix}/deleteUser/${param}`)
}
